home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK1.toast / Development Kits (Disc 1) / OpenDoc / Sample Code / Sample Editors⁄Viewers / Text Editor / Source / TextEditorSettingsExt.cpp < prev    next >
Encoding:
Text File  |  1995-12-13  |  4.1 KB  |  137 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        TextEditorSettingsExt.cpp
  3.  
  4.     Contains:    Sample Part's SOM based part public interface implementation
  5.  
  6.     Written by:    Steve Smith
  7.     
  8.     Copyright:    © 1995 by Apple Computer, Inc., all rights reserved.
  9. */
  10.  
  11. // Notification that this is a SOM source file
  12. #define TextEditorSettingsExt_Class_Source
  13.  
  14. // define underscore field names (e.g. _fSelf)
  15. #define VARIABLE_MACROS
  16.  
  17. // -- Compiler/Preprocessor Switches --
  18.  
  19. #ifndef _COMPILERDEFS_
  20. #include "CompDefs.h"
  21. #endif
  22.  
  23. // -- OpenDoc Utilities --
  24.  
  25. #ifndef _EXCEPT_
  26. // Exceptions define several important macros (e.g. CHECKENV)
  27. // which are used in the SOM method dispatch glue. If Except.h
  28. // is not included early enough, exceptions may not be thrown
  29. // correctly when returning from a SOM method with "ev" parameter set.
  30. #include <Except.h>
  31. #endif
  32.  
  33. // -- Text Editor Includes --
  34.  
  35. #ifndef SOM_TextEditorSettingsExt_xih
  36. #include "TextEditorSettingsExt.xih"
  37. #endif
  38.  
  39. #ifndef SOM_SampleCode_TextEditor_xh
  40. #include "TextEditor.xh"
  41. #endif
  42.  
  43. // -- OpenDoc Includes --
  44.  
  45. #ifndef SOM_ODSettingsExtension_xh
  46. #include <Settings.xh>
  47. #endif
  48.  
  49. #ifndef SOM_ODFacet_xh
  50. #include <Facet.xh>
  51. #endif
  52.  
  53.  
  54.  
  55. #pragma segment TextEditorSettingsExt
  56.  
  57. //==============================================================================
  58. // TextEditorSettingsExt
  59. //==============================================================================
  60.  
  61. //------------------------------------------------------------------------------
  62. // Method:        somInit
  63. // Origin:        SOMObject
  64. //
  65. // Description:    This is the SOM equivalent of a C++ class constructor.
  66. //
  67. // Warnings:    You are not allowed to throw an exception from this method.
  68. //------------------------------------------------------------------------------
  69. SOM_Scope void  SOMLINK TextEditorSettingsExt__somInit(TextEditorSettingsExt *somSelf)
  70. {
  71.     TextEditorSettingsExtMethodDebug("TextEditorSettingsExt","somInit");
  72. }
  73.  
  74. //------------------------------------------------------------------------------
  75. // Method:        somUninit
  76. // Origin:        SOMObject
  77. //
  78. // Description:    This is the SOM equivalent of a C++ class constructor.
  79. //
  80. // Warnings:    You are not allowed to throw an exception from this method.
  81. //------------------------------------------------------------------------------
  82. SOM_Scope void  SOMLINK TextEditorSettingsExt__somUninit(TextEditorSettingsExt *somSelf)
  83. {
  84.     TextEditorSettingsExtMethodDebug("TextEditorSettingsExt","somUninit");
  85. }
  86.  
  87. //------------------------------------------------------------------------------
  88. // Method:        Release
  89. // Origin:        ODRefCntObj
  90. //------------------------------------------------------------------------------
  91. SOM_Scope void  SOMLINK TextEditorSettingsExt__Release(TextEditorSettingsExt *somSelf, Environment *ev)
  92. {
  93.     TextEditorSettingsExtMethodDebug("TextEditorSettingsExt","Release");
  94.  
  95.     TextEditorSettingsExt_parent_ODSettingsExtension_Release(somSelf,ev);
  96. }
  97.  
  98. //------------------------------------------------------------------------------
  99. // Method:        InitSettingsExtension
  100. // Origin:        ODSettingsExtension
  101. //------------------------------------------------------------------------------
  102. SOM_Scope void  SOMLINK TextEditorSettingsExt__InitSettingsExtension(TextEditorSettingsExt *somSelf, Environment *ev,
  103.         ODPart* owner)
  104. {
  105.     TextEditorSettingsExtData *somThis = TextEditorSettingsExtGetData(somSelf);
  106.     TextEditorSettingsExtMethodDebug("TextEditorSettingsExt","InitSettingsExtension");
  107.  
  108.     TextEditorSettingsExt_parent_ODSettingsExtension_InitSettingsExtension(somSelf,ev,owner);
  109.     
  110.     SOM_TRY
  111.     
  112.         _fOwner = (SampleCode_TextEditor*) owner->GetRealPart(ev);
  113.         
  114.         owner->ReleaseRealPart(ev);
  115.                 
  116.     SOM_CATCH_ALL
  117.     SOM_ENDTRY
  118. }
  119.  
  120. //------------------------------------------------------------------------------
  121. // Method:        ShowSettings
  122. // Origin:        ODSettingsExtension
  123. //------------------------------------------------------------------------------
  124. SOM_Scope void  SOMLINK TextEditorSettingsExt__ShowSettings(TextEditorSettingsExt *somSelf, Environment *ev,
  125.         ODFacet* facet)
  126. {
  127.     TextEditorSettingsExtData *somThis = TextEditorSettingsExtGetData(somSelf);
  128.     TextEditorSettingsExtMethodDebug("TextEditorSettingsExt","ShowSettings");
  129.  
  130.     SOM_TRY
  131.     
  132.         _fOwner->DoSettings(ev, facet->GetFrame(ev));
  133.                 
  134.     SOM_CATCH_ALL
  135.     SOM_ENDTRY
  136. }
  137.